package com.zsj.zsjkotlinmvvm.ui.video.activity

import android.os.Bundle
import android.util.Log
import androidx.activity.viewModels
import com.shuyu.gsyvideoplayer.utils.OrientationUtils
import com.zsj.zsjkotlinmvvm.R
import com.zsj.zsjkotlinmvvm.databinding.ActivityMainBinding
import com.zsj.zsjkotlinmvvm.ui.BaseActivity
import com.zsj.zsjkotlinmvvm.ui.video.viewmodel.VideoPlayViewModel
import com.zsj.zsjkotlinmvvm.ui.view.VideoPlayerView

class VideoPlayActivity : BaseActivity<ActivityMainBinding, VideoPlayViewModel>() {

    override val layoutRes: Int = R.layout.activity_video_play
    override val viewModel by viewModels<VideoPlayViewModel> { viewModelFactory }

    private val videoPlayerView: VideoPlayerView by lazy { findViewById<VideoPlayerView>(R.id.py_video) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val bundle = intent.extras
        val url = bundle?.getString("url")
        videoPlayerView?.init(this, this, object : VideoPlayerView.CallBack {
            override fun complete() {
            }

            override fun progress(currentPosition: Int, duration: Int) {
            }

            override fun onFull(orientationUtils: OrientationUtils?, isLand: Boolean) {
            }
        })
        videoPlayerView?.setUp(url,false,"---")
        videoPlayerView?.playVideo()
        Log.e("zsj",url)


    }


}